package com.fandy.struts.SqlStatement;

public class Provision {
 
	public   String  getAll()
	{
		return   "select  * from Provision";
	}
	
	public   String getProvisionInfoByID(int ID)
	{
		return  "select * from Provision where " +com.fandy.struts.Meta.Provision.getId()+"="+ID;
	}
	
	
	public   String  existProvision(com.fandy.struts.Model.Provision p)
	{
		return  "select count(*) from Provision where "+ com.fandy.struts.Meta.Provision.getId() +" = "
		+p.getId()
		;
	}
	
	
	public String Add(com.fandy.struts.Model.Provision p)
	{
		
		return "insert into Provision values ("
		+ "'" + p.getAddress()+"',"		 
		+ "'" + p.getCompany()+"',"
		+ "'"  + p.getFax() + "',"
		// id is here
		+ "'"  + p.getName()+ "',"
		+ "'"  + p.getPostcode()+ "',"
		+ "'"  + p.getTel() + "',"				
		+")"
		;
		
	}
	
	
	public   String  existProvision(int id)
	{
		return  "select count(*) from Provision where "+ com.fandy.struts.Meta.Provision.getId() +" = "
		+id
		;
	}
	
	public String UpdateByID(int id,com.fandy.struts.Model.Provision p)
	{
		
		return "update Provision set "+com.fandy.struts.Meta.Provision.getAddress()
		+"='" + p.getAddress()+"',"		 
		+com.fandy.struts.Meta.Provision.getAddress()+"='" +p.getAddress()+"',"
		+com.fandy.struts.Meta.Provision.getCompany()+ "='"  + p.getCompany() + "',"
		+com.fandy.struts.Meta.Provision.getFax()+ "='"  + p.getFax() + "',"
		+com.fandy.struts.Meta.Provision.getName() + "='"  + p.getName() + "',"
		+com.fandy.struts.Meta.Provision.getPostcode() + "='"  + p.getPostcode() + "',"
		+com.fandy.struts.Meta.Provision.getTel() + "='"  + p.getTel()+ "'"		
		+"where "+com.fandy.struts.Meta.Provision.getId()+"="+id;		
	}
	
	public String DeleteByID(int id)
	{
		
		return "delete from Provision where " + com.fandy.struts.Meta.Provision.getId() +"="+id;
		
	}
	
	
	
}

